<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>懒加载</title>
    <style>
        .wrap .img-list{
            display: flex;
            flex-wrap: wrap;
        }
        img{
            width: 200px;
            height: 200px;
        }
    </style>
</head>

<body>
    <div class="wrap">
        <ul class="img-list J_imgList"></ul>
    </div>
    <div style="display:none" id="J_data">
        [
        {"img":"img/1.jpg","name":"图片1"},
        {"img":"img/2.png","name":"图片2"},
        {"img":"img/3.jpg","name":"图片3"},
        {"img":"img/4.jpg","name":"图片4"},
        {"img":"img/5.jfif","name":"图片5"},
        {"img":"img/6.jfif","name":"图片6"},
        {"img":"img/7.jfif","name":"图片7"},
        {"img":"img/8.jfif","name":"图片8"},
        {"img":"img/9.jfif","name":"图片9"},
        {"img":"img/10.jfif","name":"图片10"}
        ]
    </div>
    <script type="text/html" id="J_imgTpl">
        <li class="img-item">
            <div class="img-wrap">
                <img src="img/d.jfif" class="list-img" data-src="{{img}}" alt="{{name}}">
            </div>
            <div class="img-tt">
                <h1>{{name}}</h1>
            </div>
        </li>
    </script>
    <script src="js/index.js"></script>
</body>

</html>